load("@io_bazel_rules_go//go:def.bzl", "go_library", "go_test")

go_library(
    name = "storage",
    srcs = [
        "converter.go",
        "history.go",
        "nodes.go",
        "subtask_state.go",
        "task_state.go",
        "task_table.go",
    ],
    importpath = "github.com/pingcap/tidb/pkg/disttask/framework/storage",
    visibility = ["//visibility:public"],
    deps = [
        "//pkg/config",
        "//pkg/config/kerneltype",
        "//pkg/disttask/framework/proto",
        "//pkg/disttask/framework/schstatus",
        "//pkg/disttask/framework/taskexecutor/execute",
        "//pkg/keyspace",
        "//pkg/kv",
        "//pkg/sessionctx",
        "//pkg/sessionctx/vardef",
        "//pkg/util",
        "//pkg/util/chunk",
        "//pkg/util/cpu",
        "//pkg/util/hack",
        "//pkg/util/injectfailpoint",
        "//pkg/util/logutil",
        "//pkg/util/sqlescape",
        "//pkg/util/sqlexec",
        "@com_github_docker_go_units//:go-units",
        "@com_github_pingcap_errors//:errors",
        "@com_github_pingcap_failpoint//:failpoint",
        "@com_github_tikv_client_go_v2//util",
        "@org_uber_go_zap//:zap",
    ],
)

go_test(
    name = "storage_test",
    timeout = "moderate",
    srcs = [
        "table_test.go",
        "task_state_test.go",
        "task_table_test.go",
    ],
    embed = [":storage"],
    flaky = True,
    shard_count = 26,
    deps = [
        "//pkg/config",
        "//pkg/disttask/framework/proto",
        "//pkg/disttask/framework/schstatus",
        "//pkg/disttask/framework/taskexecutor/execute",
        "//pkg/disttask/framework/testutil",
        "//pkg/kv",
        "//pkg/sessionctx",
        "//pkg/sessionctx/vardef",
        "//pkg/testkit",
        "//pkg/testkit/testfailpoint",
        "//pkg/testkit/testsetup",
        "//pkg/util",
        "//pkg/util/sqlexec",
        "@com_github_pingcap_errors//:errors",
        "@com_github_stretchr_testify//require",
        "@com_github_tikv_client_go_v2//util",
        "@org_uber_go_atomic//:atomic",
        "@org_uber_go_goleak//:goleak",
    ],
)
